<template>
    <div class="num_box">
        <div class="mui-numbox" data-numbox-min='1'>
            <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
            <input id="test" class="mui-input-numbox" type="number" ref="num" value="1" @change="numchange" />
            <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
		</div>
    </div>
</template>

<script>
    import mui from '../../lib/mui/js/mui.min.js'
    export default {
        mounted() {
            mui('.mui-numbox').numbox();
        },
        methods: {
            numchange(){
                // console.log(this.$refs.num.value);
                this.$emit('postnum',this.$refs.num.value )
            }
        },
        props: ['max'],
        watch: {
            'max':function (newV,oldV) {
                mui('.mui-numbox').numbox().setOption('max',newV)
            }
        }
    }
</script>

<style lang="scss" scoped>
.num_box{
    display: inline-block;
}
</style>